package com.web.service;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.web.model.UserInfo;
import com.web.repository.UserRepository;
import com.web.util.Constants;

@Service
public class UserServiceImpl implements UserService {

	Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private UserRepository userRepository;
	
	public UserInfo insertUser(UserInfo user) {
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("userAccount", user.getUserAccount());
		params.put("password", user.getPassword());
		params.put("userActive", Constants.USER_IS_ACTIVE);
		logger.info("UserInfo.insertUser():{params={}}", new Object[]{params.toString()});
		UserInfo userInfo = new UserInfo();
		userRepository.insertUser(params);
		System.out.println("userInfo--->>" + userInfo.getUserId());
		return  userInfo;
	}
	
    public UserInfo selectUser(UserInfo user) {
		return null;
	}
	
	
}
